import 'dart:developer';

rules(type, param) {
  var result = false;
  switch (type) {
    case 'a1': //页面路径:订单/订单列表;应付:实付
      result = param['order_status'] == 1;
      break;
    case 'a2': //页面路径:订单/订单列表;查看物流按钮
      result = (param['order_status'] != 1 && param['order_status'] != 9) &&
          param['type_num_id'] == 1;
      break;
    case 'a3': //页面路径:订单/订单列表;确认收货按钮
      result = (param['order_status'] == 27 ||
              param['order_status'] == 28 ||
              param['operate_status_num_id'] == 90103) &&
          param['tran_type_num_id'] == 3 &&
          param['remain_back_qty'] > 0;
      break;
    case 'a4': //页面路径:订单/订单列表;去付款按钮
      result = param['order_status'] == 1 && param['so_sign'] != 40 ||
          param['so_sign'] == 40 && param['operate_status_num_id'] == 90060;
      break;
    case 'a5': //页面路径:订单/订单列表;评价按钮
      result = param['comment_type'] == 0;
      break;
    case 'a6': //页面路径:订单/订单列表;自提码
      result = param['verification_code'] != null;
      break;
    case 'a7': //页面路径:订单/订单列表;拼团详情
      result = param['operate_status_num_id'] == 90088;
      break;
    case 'a8': //页面路径:会员任务;储值有礼
      result = param['award_type'] == 608;
      break;
    case 'a9': //页面路径:会员任务;消费有礼
      result = param['award_type'] == 606;
      break;
    case 'a10': //页面路径:会员任务;评论有礼
      result = param['award_type'] == 604;
      break;
    case 'a11': //页面路径:会员任务;完善有礼
      result = param['complete_activity_sign'] == 1;
      break;
    case 'a12': //页面路径:会员任务;签到有礼
      result = param['sign_in_rule_type'] == 1;
      break;
    case 'a13': //页面路径:拼团订单;支付按钮
      result = param['order_state'] == 1;
      break;
    case 'a14': //申请成为慧达人:申请结果
      result = param['status_num_id'] == 1;
      break;
    case 'a15': //申请成为慧达人:申请结果
      result = param['status_num_id'] == 3;
      break;
    case 'a16': //订单详情:申请退款
      result = param['remain_cancel_qty'] != 0;
      break;
    case 'a17': //订单详情:追加评论
      result = param['comment_type'] == 1;
      break;
    case 'a18': //订单详情:查看评论
      result = param['comment_type'] == 2 || param['comment_type'] == 1;
      break;
    case 'a19': //页面路径:会员任务;邀请有利
      result = param['invite_activity_sign'] == 1;
      break;
    case 'a20': // 定金预售退预售定金
      // if (param['so_sign'] == 40) {
      //   print('++++++++++++++++++++++++');
      //   print(param['operate_status_num_id']);
      //   print(param['cancel_deposit']);
      //   print('++++++++++++++++++++++++');
      // }
      result = param['so_sign'] == 40 &&
          param['operate_status_num_id'] == 90065 &&
          param['cancel_deposit'] != 1 &&
          param['due_pay_time'] == true;
      break;
    case 'a21': // 定金预售付预售尾款
      result = param['so_sign'] == 40 &&
          param['operate_status_num_id'] == 90065 &&
          param['cancel_deposit'] != 1 &&
          param['due_pay_time'] == true;
      break;
    case 'a22': // 超级团退团 需要补差价
      result = param['so_sign'] == 19 &&
          param['operate_status_num_id'] == 90088 &&
          (param['need_pay_amount'] != null && param['need_pay_amount'] > 0 ||
              param['amount'] != null &&
                  param['amount']['need_pay_amount'] > 0) &&
          param['cancel_deposit'] != 1;
      break;
    case 'a23': // 超级团补差价
      result = param['so_sign'] == 19 &&
          param['operate_status_num_id'] == 90088 &&
          (param['need_pay_amount'] != null && param['need_pay_amount'] > 0 ||
              param['amount'] != null &&
                  param['amount']['need_pay_amount'] > 0) &&
          param['cancel_deposit'] != 1;
      break;
    case 'a24': // 加入购物车
      result = param['order_status'] == 9 ||
          param['order_status'] == 8 ||
          param['order_status'] == 20;
      break;
    case 'a25': // 超级团退团 不需要补差价
      result = param['so_sign'] == 19 &&
          (param['operate_status_num_id'] == 90075 ||
              param['operate_status_num_id'] == 90070) &&
          param['cancel_deposit'] != 1;
      break;
  }
  return result;
}
